<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">

<html>
<head>
	<title>DHTML Tree samples. dhtmlXTree - Navigation with keyboard</title>
</head>
<style>
	body {font-size:12px}
	.{font-family:arial;font-size:12px}
	h1 {cursor:hand;font-size:16px;margin-left:10px;line-height:10px}
	xmp {color:green;font-size:12px;margin:0px;font-family:courier;background-color:#e6e6fa;padding:2px}
</style>
<body>
	<h1>Navigation with keyboard</h1>
	<link rel="STYLESHEET" type="text/css" href="../css/dhtmlXTree.css">
	<script  src="../js/dhtmlXCommon.js"></script>
	<script  src="../js/dhtmlXTree.js"></script>
	<script  src="../js/dhtmlXTree_kn.js"></script>
	<table>
		<tr>
			<td>
				<div id="treeboxbox_tree" style="width:250; height:218;background-color:#f5f5f5;border :1px solid Silver;; overflow:auto;"></div>
			</td>
			<td rowspan="2" style="padding-left:25" valign="top">
				<a href="#" onclick="tree.enableKeyboardNavigation(true);">Enable navigation</a><br>
				<a href="#" onclick="tree.enableKeyboardNavigation(false);">Disable navigation</a><br>
                <a href='#' onclick='tree.assignKeys([["up",104],["down",98],["open",102],["close",100],["call",101]]);'>
                set custom keys - numeric keypad (2,4,5,6,8)
                </a>
                <br>
                <br>
                <b><div id='a_33'></div></b>
			</td>
		</tr>
		<tr>
			<td>
			</td>
		</tr>
	</table>
    <xmp>
			tree=new dhtmlXTreeObject("treeboxbox_tree","100%","100%",0);
			tree.setImagePath("../imgs/");
			tree.enableSmartXMLParsing(true);
			tree.enableDragAndDrop(true);
            //enable navigation
			tree.enableKeyboardNavigation(true);
			tree.loadXML("tree.xml");

            ...
            //set custom keys - numeric keypad
            tree.assignKeys([["up",104],["down",98],["open",102],["close",100],["call",101]]);
    </xmp>
<hr>
    Select any item in tree and use next keys
        <li>Up arrow - select upper item</li>
        <li>Down arrow - select lower item</li>
        <li>Right arrow - open item</li>
        <li>Left arrow - close item</li>
        <li>Enter - call item's action</li>
	<script>

            function m_f(id){
                document.getElementById("a_33").innerHTML=("Item "+id);
            }
			tree=new dhtmlXTreeObject("treeboxbox_tree","100%","100%",0);
			tree.setImagePath("../imgs/");
			tree.enableSmartXMLParsing(true);
            tree.setOnClickHandler(m_f);
            tree.enableDragAndDrop(true);
            tree.enableKeyboardNavigation(true);
			tree.loadXML("tree.xml");
	</script>
<br><br>

</body>
</html>
